import request from '@/utils/request'

// 专区课程分页
export function zoneExperimentPage(data) {
  return request({url: '/course/admin/zone/experiment/page', method: 'post', data})
}

// 专区实验修改
export function zoneExperimentEdit(data) {
  return request.put('/course/admin/zone/experiment/edit', data)
}

// 专区实验保存
export function zoneExperimentSave(data) {
  return request.post('/course/admin/zone/experiment/save', data)
}

// 专区实验修改
export function zoneExperimentDelete(data) {
  return request.delete('/course/admin/zone/experiment/delete?id=' + data.id, data)
}

// 专区分页
export function zonePage(data) {
  return request({url: '/course/admin/zone/page', method: 'post', data})
}

// 专区修改
export function zoneEdit(data) {
  return request.put('/course/admin/zone/edit', data)
}

// 专区保存
export function zoneSave(data) {
  return request.post('/course/admin/zone/save', data)
}

// 专区修改
export function zoneDelete(data) {
  return request.delete('/course/admin/zone/delete?id=' + data.id, data)
}

// 分类列表
export function categoryList(data) {
  return request({url: '/course/admin/category/list', method: 'post', data: data})
}

// 分类修改
export function categoryEdit(data) {
  return request.put('/course/admin/category/edit', data)
}

// 分类保存
export function categorySave(data) {
  return request.post('/course/admin/category/save', data)
}

// 分类修改
export function categoryDelete(data) {
  return request.delete('/course/admin/category/delete?id=' + data.id, data)
}

// 资源分页
export function resourcePage(params, pageCurrent = 1, pageSize = 20) {
  return request({url: '/course/admin/resource/page', method: 'post', data: {pageCurrent: pageCurrent, pageSize: pageSize, ...params}})
}

// 资源修改
export function resourceEdit(data) {
  return request.put('/course/admin/resource/edit', data)
}

// 资源保存
export function resourceSave(data) {
  return request.post('/course/admin/resource/save', data)
}

// 资源修改
export function resourceDelete(data) {
  return request.delete('/course/admin/resource/delete?id=' + data.id, data)
}

// 实验章节分页
export function courseChapterPeriodPage(params, pageCurrent = 1, pageSize = 20) {
  return request({url: '/course/admin/experiment/chapter/period/page', method: 'post', data: {pageCurrent: pageCurrent, pageSize: pageSize, ...params}})
}

// 实验章节修改
export function courseChapterPeriodEdit(data) {
  return request.put('/course/admin/experiment/chapter/period/edit', data)
}

// 实验章节保存
export function courseChapterPeriodSave(data) {
  return request.post('/course/admin/experiment/chapter/period/save', data)
}

// 实验章节修改
export function experimentChapterPeriodDelete(data) {
  return request.delete('/course/admin/experiment/chapter/period/delete?id=' + data.id, data)
}

// 实验章分页
export function experimentChapterPage(params, pageCurrent = 1, pageSize = 20) {
  return request({url: '/course/admin/experiment/chapter/page', method: 'post', data: {pageCurrent: pageCurrent, pageSize: pageSize, ...params}})
}

// 实验章修改
export function experimentChapterEdit(data) {
  return request.put('/course/admin/experiment/chapter/edit', data)
}

// 实验章保存
export function experimentChapterSave(data) {
  return request.post('/course/admin/experiment/chapter/save', data)
}

// 实验章修改
export function experimentChapterDelete(data) {
  return request.delete('/course/admin/experiment/chapter/delete?id=' + data.id, data)
}

// 实验分页
export function experimentPage(params, pageCurrent = 1, pageSize = 20) {
  return request({url: '/course/admin/experiment/page', method: 'post', data: {pageCurrent: pageCurrent, pageSize: pageSize, ...params}})
}

// 实验详情
export function experimentView(id) {
  return request.get('/course/admin/experiment/view?id=' + id)
}

// 实验修改
export function experimentEdit(data) {
  if (data.liulanqi) {
    data.liulanqi = data.liulanqi.toString();
  }
  return request.put('/course/admin/experiment/edit', data)
}

// 实验保存
export function experimentSave(data) {
  if (data.liulanqi) {
    data.liulanqi = data.liulanqi.toString();
  }
  return request.post('/course/admin/experiment/save', data)
}

// 实验修改
export function experimentDelete(data) {
  return request.delete('/course/admin/experiment/delete?id=' + data.id, data)
}

// 分页
export function userexperimentPage(params, pageCurrent = 1, pageSize = 20) {
  return request({url: '/course/admin/user/experiment/page', method: 'post', data: {pageCurrent: pageCurrent, pageSize: pageSize, ...params}})
}

// 分页
export function userStudyePage(params, pageCurrent = 1, pageSize = 20) {
  return request({url: '/course/admin/user/study/page', method: 'post', data: {pageCurrent: pageCurrent, pageSize: pageSize, ...params}})
}
